package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.SalesDetailItemMapper;
import com.ruoyi.business.domain.SalesDetailItem;
import com.ruoyi.business.service.ISalesDetailItemService;

/**
 * 销售单明细Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-03
 */
@Service
public class SalesDetailItemServiceImpl implements ISalesDetailItemService 
{
    @Autowired
    private SalesDetailItemMapper salesDetailItemMapper;

    /**
     * 查询销售单明细
     * 
     * @param id 销售单明细主键
     * @return 销售单明细
     */
    @Override
    public SalesDetailItem selectSalesDetailItemById(Long id)
    {
        return salesDetailItemMapper.selectSalesDetailItemById(id);
    }

    /**
     * 根据销售单据编号查询销售单明细列表
     * 
     * @param receiptCode 单据编号
     * @return 销售单明细集合
     */
    @Override
    public List<SalesDetailItem> selectSalesDetailItemsByReceiptCode(String receiptCode)
    {
        return salesDetailItemMapper.selectSalesDetailItemsByReceiptCode(receiptCode);
    }

    /**
     * 查询销售单明细列表
     * 
     * @param salesDetailItem 销售单明细
     * @return 销售单明细
     */
    @Override
    public List<SalesDetailItem> selectSalesDetailItemList(SalesDetailItem salesDetailItem)
    {
        return salesDetailItemMapper.selectSalesDetailItemList(salesDetailItem);
    }

    /**
     * 新增销售单明细
     * 
     * @param salesDetailItem 销售单明细
     * @return 结果
     */
    @Override
    public int insertSalesDetailItem(SalesDetailItem salesDetailItem)
    {
        salesDetailItem.setCreateTime(DateUtils.getNowDate());
        return salesDetailItemMapper.insertSalesDetailItem(salesDetailItem);
    }

    /**
     * 修改销售单明细
     * 
     * @param salesDetailItem 销售单明细
     * @return 结果
     */
    @Override
    public int updateSalesDetailItem(SalesDetailItem salesDetailItem)
    {
        salesDetailItem.setUpdateTime(DateUtils.getNowDate());
        return salesDetailItemMapper.updateSalesDetailItem(salesDetailItem);
    }

    /**
     * 批量删除销售单明细
     * 
     * @param ids 需要删除的销售单明细主键
     * @return 结果
     */
    @Override
    public int deleteSalesDetailItemByIds(Long[] ids)
    {
        return salesDetailItemMapper.deleteSalesDetailItemByIds(ids);
    }

    /**
     * 删除销售单明细信息
     * 
     * @param id 销售单明细主键
     * @return 结果
     */
    @Override
    public int deleteSalesDetailItemById(Long id)
    {
        return salesDetailItemMapper.deleteSalesDetailItemById(id);
    }
}
